package demo.practice.leetcode_base;

public class P389 {

    public static void main(String[] args) {
        P389 p389= new P389();
        p389.findTheDifference( "abcd", "abcde");
    }

    public char findTheDifference(String s, String t) {
        int [] chs= new int[26];
        for(int i=0;i<s.length();i++){
            chs[s.charAt(i)-'a']++;
        }

        for(int j=0;j<t.length();j++){
            chs[t.charAt(j)-'a']--;
            if(chs[t.charAt(j)-'a']<0)
                return t.charAt(j);
        }

        return  'a';
    }
}
